import 'dart:convert';

import 'package:jetour_line/models/public_msg_manger.dart';
import 'package:jetour_line/models/user_info_model.dart';
import 'package:jetour_line/network/jetour_http.dart';

import '../network/aha_http.dart';
typedef _LoginSuccessCallBack = void Function(bool isLogin);
class LoginUtils{
  static void login( String token, _LoginSuccessCallBack callBack ){
    Map<String, dynamic>? params = Map();
    params['token'] = token;
    AhaHttp().post(AhaRouter.MyJetourTokenLogin,data:params).then((value) {
      print(value);
       UserInfoModel userInfoModel = UserInfoModel.fromJson(value);
       PublicMsgManger().userInfoModel = userInfoModel;
       UserInfoModel us =   PublicMsgManger().userInfoModel!;
       callBack(userInfoModel != null);
    });
  }
  static void logOut(){
    PublicMsgManger().userInfoModel = null;
  }
}